﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;
using BUS;
namespace MasterPageGroupF3
{
    public partial class WebForm4 : System.Web.UI.Page
    {
        
        protected void Button1_Click(object sender, EventArgs e)
        {

        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            if (Request.QueryString["IDMember"] == null)
            {
                Response.Write("<script language='javascript'>alert('Chua đăng nhập');</script>");
            }
            else
            {
                string s = Request.QueryString["IDMember"].ToString();
                MEMBER mem = MEMBERBUS.getMemberByEmail(s);
                string matKhau = TextBox2.Text;
                if (matKhau == mem.PASSWORD)
                {
                    string hoTen = TextBox4.Text;
                    string diaChi = TextBox5.Text;
                    string dienThoai = TextBox6.Text;
                    MEMBERBUS.updateMember(mem.IDMEMBER, matKhau, hoTen, diaChi, dienThoai);
                    Response.Write("<script language='javascript'>alert('Cập Nhật Thành công');</script>");
                }
                else
                {
                    Response.Write("<script language='javascript'>alert('Mật Khẩu Hiện Tại Không đúng');</script>");
                }
                
                
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            
                string s = Request.QueryString["IDMember"].ToString();
                MEMBER mem = MEMBERBUS.getMemberByEmail(s);
                TextBox4.Text = mem.NAME;
                TextBox5.Text = mem.ADDRESS;
                TextBox6.Text = mem.PHONE;
            
           
        }
    }
}